#!/bin/bash

# 修复 bcrypt 兼容性问题

echo "🔧 修复 bcrypt 兼容性问题"
echo ""

# 卸载可能冲突的包
echo "1️⃣  卸载旧版本..."
pip uninstall -y bcrypt passlib

# 安装指定版本
echo ""
echo "2️⃣  安装兼容版本..."
pip install bcrypt==4.0.1
pip install passlib[bcrypt]==1.7.4

echo ""
echo "3️⃣  验证安装..."
python -c "from passlib.context import CryptContext; pwd_context = CryptContext(schemes=['bcrypt'], deprecated='auto'); print('✅ bcrypt 工作正常')"

echo ""
echo "🎉 修复完成！"
echo ""
echo "📝 下一步："
echo "  • 重启后端服务"
echo "  • 测试注册功能"
echo ""

